<template>
	<view class="loginContainer">
		<p class="text">哈弗商城欢迎你！</p>
		<div class="loginMethods">
			<button class="login wechatLogin" @click="getUserInfo">微信登录</button>
			<button class="login emailLogin">邮箱登录</button>
		</div>
	</view>
</template>

<script>
export default {
	data() {
		return {};
	},
	mounted() {},
	methods: {
		getUserInfo(){
			this.$store.dispatch('getCartList') //登录发个请求
			 wx.getUserProfile({
			      desc: '用于完善会员资料', // 声明获取用户个人信息后的用途，后续会展示在弹窗中，请谨慎填写
			      success: (res) => {
						// console.log(res);
						//保存用户信息到storage
						wx.setStorageSync('userInfo_key',res.userInfo)
						//返回到个人中心页面
						wx.reLaunch({
							url:'/pages/center/center'
						})
			      }
			    })
		}
	}
};
</script>

<style lang="stylus">
.loginContainer
	width 100%
	height 100%
	background #F8F8F8
	display flex
	flex-direction column
	justify-content center
	align-items center
	.text
		font-size 50upx
		color #666
	.loginMethods
		width 80%
		margin 150upx auto
		display flex
		justify-content space-around
		.login
			width 240upx
			height 80upx
			background #41A863
			color #FFFFFF
			text-align center
			line-height 80upx
			font-size 26upx
</style>
